import request from '@/utils/request'

const activityApi = {
  // 活动列表
  getActivityList: (params) => {
    return request({
      url: '/promotion/activity-signup/page',
      method: 'GET',
      params
    })
  },
  // 获取活动详情
  getActivityDetail: (params) => {
    return request({
      url: '/promotion/activity/get',
      method: 'GET',
      params
    })
  },
  // 可选商品列表
  getCheckGoodsList: (params) => {
		return request({
			url: '/promotion/activity/list/optional/product',
			method: 'GET',
      params
		})
	},
  // 提交报名商品
  submitActivityGoods: (data) => {
    return request({
			url: '/promotion/activity-signup/create',
			method: 'POST',
      data
		})
  },
  // 获取报名记录列表
  getRecordList: (params) => {
    return request({
      url: '/promotion/activity-signup/page/record',
      method: 'GET',
      params
    })
  },
  // 已选商品列表
  getCheckedGoodsList: (recordId) => {
		return request({
			url: `/promotion/activity-signup/list/selected/product?id=${recordId}`,
			method: 'GET'
		})
	},
  // 更新报名商品
  updateActivityGoods: (data) => {
		return request({
			url: '/promotion/activity-signup/update',
			method: 'PUT',
      data
		})
	},
  // 获取活动统计数据
  getStatisticData: (supplierId) => {
    return request({
      url: `/promotion/activity-signup/overview?supplierId=${supplierId}`,
      method: 'GET'
    })
  },
  // 获取活动订单统计数据
  getStatisticOrder: (supplierId) => {
    return request({
      url: `/trade/order/getActivityCount?supplierId=${supplierId}&type=2`,
      method: 'GET'
    })
  },
}

export default activityApi
